<?php
/**
 * Date: 2024.8
 * Author: kahn
 */
namespace models\vip;

use driver\ThinkOrm;

class UserModel extends ThinkOrm
{
    protected $table = 'vip_user';
    protected $pk = ['userId'];

    /**
     * @param $userId
     * @return static
     */
    public static function vip($userId): static
    {
        return static::where('userId', $userId)
            ->findOrEmpty();
    }

    public static function isVip($userId): bool
    {
        return static::where('userId',$userId)
            ->where('status',1)
            ->where('vipTime','>', time())
            ->findOrEmpty()
            ->isEmpty();
    }
}